{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import os\n",
    "\n",
    "from pandas import set_option\n",
    "set_option(\"display.max_rows\",10)\n",
    "set_option('display.width', 200)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "element_names = [\"DTXX\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 定义要输入的维度AC、CNL、DEN、GR、RD、RS\n",
    "# input_vectors = [\"AC\",\"CNL\",\"DEN\",\"GR\",\"RD\",\"RS\"]\n",
    "input_vectors = [\"DT\",\"CNL\",\"DEN\",\"GR\",\"RD\",\"RS\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "train_data_path = '../data/exp_curve_reconstract/exp_1/train/QSK/'\n",
    "filename_AB = 'GY1_R_0.1250m_QSK_2107m-2587m.csv'\n",
    "train_file_path = os.path.join(train_data_path,filename_AB)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 待预测段的常规测井曲线\n",
    "test_data_path = '../data/exp_curve_reconstract/exp_1/test/QSK/'\n",
    "filename_A = 'C21_R_ 0.1250m_QSK_1260m-1668m.csv'\n",
    "test_file_path = os.path.join(test_data_path,filename_A)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# View training set range(查看训练集范围)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "         DEPTH         DT   CNL    DEN   GR    RD    RS        DTXX\n0     2107.000  82.196225  17.3  2.451  120  4.91  5.11  168.247598\n1     2107.125  81.984576  16.9  2.444  118  5.18  5.37  166.368776\n2     2107.250  81.677681  16.3  2.437  116  5.40  5.60  165.172409\n3     2107.375  81.509332  15.8  2.435  114  5.55  5.76  164.581235\n4     2107.500  81.742845  15.7  2.448  116  5.57  5.82  164.762338\n...        ...        ...   ...    ...  ...   ...   ...         ...\n3836  2586.500  86.894184  15.4  2.652  138  5.31  6.30  169.218485\n3837  2586.625  85.568864  14.9  2.651  136  5.35  6.32  162.964982\n3838  2586.750  81.355412  14.0  2.646  135  5.59  6.52  156.272841\n3839  2586.875  76.638988  12.5  2.645  127  6.50  7.39  149.232910\n3840  2587.000  72.828514  10.4  2.650  114  8.64  9.39  142.077324\n\n[3841 rows x 8 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>DEPTH</th>\n      <th>DT</th>\n      <th>CNL</th>\n      <th>DEN</th>\n      <th>GR</th>\n      <th>RD</th>\n      <th>RS</th>\n      <th>DTXX</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2107.000</td>\n      <td>82.196225</td>\n      <td>17.3</td>\n      <td>2.451</td>\n      <td>120</td>\n      <td>4.91</td>\n      <td>5.11</td>\n      <td>168.247598</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2107.125</td>\n      <td>81.984576</td>\n      <td>16.9</td>\n      <td>2.444</td>\n      <td>118</td>\n      <td>5.18</td>\n      <td>5.37</td>\n      <td>166.368776</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2107.250</td>\n      <td>81.677681</td>\n      <td>16.3</td>\n      <td>2.437</td>\n      <td>116</td>\n      <td>5.40</td>\n      <td>5.60</td>\n      <td>165.172409</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2107.375</td>\n      <td>81.509332</td>\n      <td>15.8</td>\n      <td>2.435</td>\n      <td>114</td>\n      <td>5.55</td>\n      <td>5.76</td>\n      <td>164.581235</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2107.500</td>\n      <td>81.742845</td>\n      <td>15.7</td>\n      <td>2.448</td>\n      <td>116</td>\n      <td>5.57</td>\n      <td>5.82</td>\n      <td>164.762338</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>3836</th>\n      <td>2586.500</td>\n      <td>86.894184</td>\n      <td>15.4</td>\n      <td>2.652</td>\n      <td>138</td>\n      <td>5.31</td>\n      <td>6.30</td>\n      <td>169.218485</td>\n    </tr>\n    <tr>\n      <th>3837</th>\n      <td>2586.625</td>\n      <td>85.568864</td>\n      <td>14.9</td>\n      <td>2.651</td>\n      <td>136</td>\n      <td>5.35</td>\n      <td>6.32</td>\n      <td>162.964982</td>\n    </tr>\n    <tr>\n      <th>3838</th>\n      <td>2586.750</td>\n      <td>81.355412</td>\n      <td>14.0</td>\n      <td>2.646</td>\n      <td>135</td>\n      <td>5.59</td>\n      <td>6.52</td>\n      <td>156.272841</td>\n    </tr>\n    <tr>\n      <th>3839</th>\n      <td>2586.875</td>\n      <td>76.638988</td>\n      <td>12.5</td>\n      <td>2.645</td>\n      <td>127</td>\n      <td>6.50</td>\n      <td>7.39</td>\n      <td>149.232910</td>\n    </tr>\n    <tr>\n      <th>3840</th>\n      <td>2587.000</td>\n      <td>72.828514</td>\n      <td>10.4</td>\n      <td>2.650</td>\n      <td>114</td>\n      <td>8.64</td>\n      <td>9.39</td>\n      <td>142.077324</td>\n    </tr>\n  </tbody>\n</table>\n<p>3841 rows × 8 columns</p>\n</div>"
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 读取A、B部分共有数据\n",
    "AB = pd.read_csv(train_file_path,engine='python',encoding='GBK')\n",
    "AB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "X = AB.loc[:,input_vectors]\n",
    "Y = AB.loc[:, element_names]  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "minX = np.min(X)\n",
    "maxX = np.max(X)\n",
    "minY = np.min(Y)\n",
    "maxY = np.max(Y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "(1.966, 157.0)"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "minX,maxX"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "(131.7215944, 225.2525799)"
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "minY,maxY"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# View test set scope(查看测试集范围)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "AB_new = pd.read_csv(test_file_path,engine='python',encoding='GBK')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "         DEPTH          DT     CNL    DEN       GR     RD     RS        DTXX\n0     1260.000   97.479675  32.616  2.281  117.390  2.895  2.927  200.676273\n1     1260.125   96.227397  33.075  2.219  116.198  2.959  3.003  203.242241\n2     1260.250   98.291990  33.748  2.184  118.071  2.933  2.987  207.089322\n3     1260.375  102.595468  33.746  2.180  121.909  2.816  2.885  211.811087\n4     1260.500  106.571764  32.860  2.195  125.995  2.651  2.733  216.707987\n...        ...         ...     ...    ...      ...    ...    ...         ...\n3180  1667.500  101.874630  28.255  2.306  137.251  4.409  4.762  224.517770\n3181  1667.625  103.317856  29.102  2.287  138.654  4.360  4.662  225.238336\n3182  1667.750  104.394786  29.196  2.272  138.694  4.266  4.531  225.355662\n3183  1667.875  103.615636  28.285  2.268  138.622  4.158  4.402  224.761265\n3184  1668.000  104.755236  26.881  2.269  138.885  4.088  4.329  222.796288\n\n[3185 rows x 8 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>DEPTH</th>\n      <th>DT</th>\n      <th>CNL</th>\n      <th>DEN</th>\n      <th>GR</th>\n      <th>RD</th>\n      <th>RS</th>\n      <th>DTXX</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1260.000</td>\n      <td>97.479675</td>\n      <td>32.616</td>\n      <td>2.281</td>\n      <td>117.390</td>\n      <td>2.895</td>\n      <td>2.927</td>\n      <td>200.676273</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1260.125</td>\n      <td>96.227397</td>\n      <td>33.075</td>\n      <td>2.219</td>\n      <td>116.198</td>\n      <td>2.959</td>\n      <td>3.003</td>\n      <td>203.242241</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1260.250</td>\n      <td>98.291990</td>\n      <td>33.748</td>\n      <td>2.184</td>\n      <td>118.071</td>\n      <td>2.933</td>\n      <td>2.987</td>\n      <td>207.089322</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1260.375</td>\n      <td>102.595468</td>\n      <td>33.746</td>\n      <td>2.180</td>\n      <td>121.909</td>\n      <td>2.816</td>\n      <td>2.885</td>\n      <td>211.811087</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1260.500</td>\n      <td>106.571764</td>\n      <td>32.860</td>\n      <td>2.195</td>\n      <td>125.995</td>\n      <td>2.651</td>\n      <td>2.733</td>\n      <td>216.707987</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>3180</th>\n      <td>1667.500</td>\n      <td>101.874630</td>\n      <td>28.255</td>\n      <td>2.306</td>\n      <td>137.251</td>\n      <td>4.409</td>\n      <td>4.762</td>\n      <td>224.517770</td>\n    </tr>\n    <tr>\n      <th>3181</th>\n      <td>1667.625</td>\n      <td>103.317856</td>\n      <td>29.102</td>\n      <td>2.287</td>\n      <td>138.654</td>\n      <td>4.360</td>\n      <td>4.662</td>\n      <td>225.238336</td>\n    </tr>\n    <tr>\n      <th>3182</th>\n      <td>1667.750</td>\n      <td>104.394786</td>\n      <td>29.196</td>\n      <td>2.272</td>\n      <td>138.694</td>\n      <td>4.266</td>\n      <td>4.531</td>\n      <td>225.355662</td>\n    </tr>\n    <tr>\n      <th>3183</th>\n      <td>1667.875</td>\n      <td>103.615636</td>\n      <td>28.285</td>\n      <td>2.268</td>\n      <td>138.622</td>\n      <td>4.158</td>\n      <td>4.402</td>\n      <td>224.761265</td>\n    </tr>\n    <tr>\n      <th>3184</th>\n      <td>1668.000</td>\n      <td>104.755236</td>\n      <td>26.881</td>\n      <td>2.269</td>\n      <td>138.885</td>\n      <td>4.088</td>\n      <td>4.329</td>\n      <td>222.796288</td>\n    </tr>\n  </tbody>\n</table>\n<p>3185 rows × 8 columns</p>\n</div>"
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AB_new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "X_new = AB_new.loc[:,input_vectors]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "minX_new = np.min(X_new)\n",
    "maxX_new = np.max(X_new)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.837 306.655\n"
     ]
    }
   ],
   "source": [
    "print(minX_new,maxX_new)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "256px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}